package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.media.pojos.WmUser;
import com.heima.wemedia.api.WmUserControllerApi;
import com.heima.wemedia.service.WmUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/user")
public class WmUserController implements WmUserControllerApi {

    @Autowired
    private WmUserService wmUserService;

    @PostMapping("/save")
    @Override
    public ResponseResult insert(@RequestBody WmUser wmUser) {
        return wmUserService.insert(wmUser);
    }


    @GetMapping("/findByName/{id}")
    @Override
    public ResponseResult findById(@PathVariable("id") Integer id) {
        return wmUserService.findById(id);
    }
}
